<template>
  <div>
    <a-modal title="离职人员列表" :width="width" :visible="visible" @cancel="cancel" :closable="Dialog">
      <template #footer>
        <a-button key="back" @click="cancel">关闭</a-button>
      </template>
      <a-table
        :data-source="getData"
        :columns="columns"
        :pagination="ipagination"
        :loading="loading"
        bordered
        @change="handleTableChange"
      >
      </a-table>
    </a-modal>
  </div>
</template>

<script>
const columns = [
  { dataIndex: 'bumen', key: 'bumen', title: '部门' },
  { dataIndex: 'gwname', key: 'gwname', title: '岗位名称' },
  { dataIndex: 'name', key: 'name', title: '姓名' },
  { dataIndex: 'sfzh', key: 'sfzh', title: '身份证' },
  { dataIndex: 'lizhireason', key: 'lizhireason', title: '离职原因' }
]
import { postAction ,getAction} from '@/api/manage'
export default {
  name:"YLZ",
  props: {
      YLZPERData:{
        visible: false,
        rows: [],
      }
  },
  created() {
       var params={
          pageNo:1,
          pageSize:10
        }
      this.getList(params)
  },
  data() {
    return {
      columns,
      width: 1400,
      visible: true,
      getData:[],
      Dialog:false,
      loading:false,
      url:"/bj/bjIdcardfk/getLizhiBjQuitPage",
      ipagination:{}
    }
  },
//   watch:{
//     YLZPERData: {
//       handler: function (newVal, oldVal) {
//         if (newVal) {
//           console.log(newVal);
//           this.visible = true;
//         }
//       },
//       deep: true,
//       immediate: true,
//     },
//   },
  methods: {
      getList(params){
        this.loading = true;
        getAction(this.url,Object.assign(params)).then((res)=>{
        if (res.success) {
          this.loading = false;
          let dataSource = res.result
          if (!(dataSource instanceof Array)) {
            const pagination = { ...this.ipagination };
            pagination.total = res.result.total;
            this.getData = res.result.records;
            this.ipagination = pagination;
            
          }
        }
      });
      },
      handleTableChange(pagination, filters, sorter){
        const pager = { ...this.ipagination };
        pager.current = pagination.current;
        this.ipagination = pager;
        var params={
          pageNo:pagination.current,
          pageSize:pagination.pageSize
        }
        this.getList(params)
      },
      cancel() {
        this.$emit('ylzChiid', '')
        this.$emit('close')
        this.visible = false
      },
  },
}
</script>

<style>
</style>